@extends('blog.layouts.default')

@section('content')

  <header class="home-bg">
    @include('blog.layouts.navbar')
    <div class="heading">
      <h1>Dzgrief</h1>
      <p>静以修身，俭以养德</p>
    </div>
  </header>

  <div class="home-content container">
    <div class="row">
      @if ($posts->count() > 0)
        <div class="preview-list col-lg-9 col-md-10">
          @foreach ($posts as $post)
            <div class="preview hr">
              <a href="{{ route('detail', $post->slug) }}">
                <span class="preview-title">{{ $post->title }}</span>
                <div class="preview-body">{!! $post->summary !!}</div>
              </a>
              <span class="preview-date">Published on {{ $post->publish_date }}</span>
            </div>
          @endforeach

          {!! $posts->links('vendor.pagination.simple') !!}
        </div>
      @endif

      <div class="home-sidebar col-lg-3 col-md-2">
        @if ($tags->count() > 0)
          <div class="section hr">
            <h4>Tags</h4>
            <div class="tags">
              @foreach ($tags as $tag)
                <a href="{{ route('tags', $tag->name) }}">{{ $tag->name }}</a>
              @endforeach
            </div>
          </div>
        @endif
        @if ($archives->count() > 0)
          <div class="section hr">
            <h4>Archive</h4>
            <div class="archives">
              @foreach ($archives as $archive)
                <a href="{{ route('archives') }}#{{ $archive->publish_years }}">
                  {{ $archive->publish_years }} ({{ $archive->quantity }})
                </a>
              @endforeach
            </div>
          </div>
        @endif
      </div>
    </div>
  </div>
@endsection
